package org.electrical.controller.functionality;

import org.electrical.dao.EleStoreDao;
import org.electrical.pojo.EleStore;
import org.electrical.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/store")
@CrossOrigin(value = "*")
public class EleStoreController {

    @Autowired
    private EleStoreDao eleStoreDao;

    @RequestMapping("/list")
    @ResponseBody
    public ResponseResult<List<EleStore>> list() {

        List<EleStore> list = eleStoreDao.getAll();
        return new ResponseResult(list);

    }

}
